public class code7 {
    //丢失的数字
    //思路1：求和
    public int missingNumber(int[] nums) {
        int n = nums.length;
        int sum = (0+n)*(n+1)/2;
        for(int x:nums) {
            sum-=x;
        }
        return sum;
    }
}
